{extend name="common/common" /}

{block name="content"}
<el-row>
	<el-col :md="12">
		<div class="ibox-title">
		    <h5>选择报表年份（年报）</h5>
		</div>
		<div class="ibox-content">
			<el-form label-width="120px">
				<el-form-item label="选择报表年份">
					<el-date-picker
						v-model="rptDate"
						type="year" value-format="yyyy"
						placeholder="选择报表年份">
				    </el-date-picker>
				</el-form-item>
				<el-form-item label=" ">
					<el-button type="primary" @click="check" plain>上报</el-button>
				</el-form-item>
			</el-form>
		</div>
	</el-col>
</el-row>
{/block}

{block name="script"}
<script type="text/javascript">
var main =  new Vue({
	el:"#main",
	data:{
		loading:false,
		rptDate:"",
	},
	methods:{
		writeTable(data) {
			var url = "{:url('Commit/Year')}?rpt_date="+data.rpt_date;
			url += "&depart_name="+data.depart_name;
			url += "&depart_id="+data.depart_id;
			window.location.href = url;
		},
		check() {
			var param = {rptDate:this.rptDate}
			$.post("./CheckYear",param,function(res){
				if(res.code == 1){
					main.writeTable(res.data);
				}else{
					main.$notify.error({
						title:"错误",
						message:res.msg
					})
				}
			})
		}
	}
})
</script>
{/block}
